import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/home',
      component: () => import('@/views/Home/Home.vue')
    },
    {
      path: '/message',
      component: () => import('@/views/Message/Message.vue')
    },
    {
      path: '/shop',
      component: () => import('@/views/Shop/Shop.vue')
    },
    {
      path: '/:callAll(.*)',
      redirect: '/'
    }
  ]
})

// 导航守卫
router.beforeEach((_to, _form, next) => {
  next()
})

export default router
